/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package prototype.santana;

import java.io.File;
import javax.swing.DefaultListModel;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Eric
 */
public class MaintenanceManagerGUI extends javax.swing.JFrame {
    private DefaultListModel sessionListModel;
    private DefaultListModel studentListModel;
    private DefaultListModel scenarioListModel;

    /**
     * Creates new form MaintenanceManagerGUI
     */
    public MaintenanceManagerGUI() {
        initComponents();
        setVisible(true);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        rootTabbedPane = new javax.swing.JTabbedPane();
        studentManagerPanel = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        sessionList = new javax.swing.JList();
        jScrollPane2 = new javax.swing.JScrollPane();
        studentList = new javax.swing.JList();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        addSessionButton = new javax.swing.JButton();
        addStudentButton = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JSeparator();
        jSeparator2 = new javax.swing.JSeparator();
        jButton4 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        jButton8 = new javax.swing.JButton();
        jSeparator3 = new javax.swing.JSeparator();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        studentManagerControlTabbedPane = new javax.swing.JTabbedPane();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane5 = new javax.swing.JScrollPane();
        jTable4 = new javax.swing.JTable();
        sortByNameButton = new javax.swing.JButton();
        sortByScoreButton = new javax.swing.JButton();
        jPanel7 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        studentTable = new javax.swing.JTable();
        jButton7 = new javax.swing.JButton();
        studentNameLabel = new javax.swing.JLabel();
        printButton = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        changePasswordButton = new javax.swing.JButton();
        changeUserNameButton = new javax.swing.JButton();
        jSeparator6 = new javax.swing.JSeparator();
        jLabel15 = new javax.swing.JLabel();
        currentStudentUserNameLabel = new javax.swing.JLabel();
        currentStudentPasswordLabel = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        scenarioManagerPanel = new javax.swing.JPanel();
        jScrollPane7 = new javax.swing.JScrollPane();
        scenarioList = new javax.swing.JList();
        jLabel7 = new javax.swing.JLabel();
        jSeparator4 = new javax.swing.JSeparator();
        previewTabbedPane = new javax.swing.JTabbedPane();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane8 = new javax.swing.JScrollPane();
        jTable3 = new javax.swing.JTable();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jScrollPane10 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jTextField2 = new javax.swing.JTextField();
        jScrollPane11 = new javax.swing.JScrollPane();
        jTextArea2 = new javax.swing.JTextArea();
        jButton11 = new javax.swing.JButton();
        jButton19 = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        jScrollPane9 = new javax.swing.JScrollPane();
        documentationTable = new javax.swing.JTable();
        jButton12 = new javax.swing.JButton();
        jButton13 = new javax.swing.JButton();
        jButton14 = new javax.swing.JButton();
        jPanel6 = new javax.swing.JPanel();
        jLabel12 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        scenarioSummaryTextPane = new javax.swing.JTextPane();
        jButton10 = new javax.swing.JButton();
        jLabel8 = new javax.swing.JLabel();
        jButton16 = new javax.swing.JButton();
        jSeparator5 = new javax.swing.JSeparator();
        addScenarioButton = new javax.swing.JButton();
        removeScenarioButton = new javax.swing.JButton();
        logOutPanel = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);

        rootTabbedPane.setPreferredSize(new java.awt.Dimension(1037, 727));
        rootTabbedPane.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                rootTabbedPaneStateChanged(evt);
            }
        });

        studentManagerPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        sessionListModel = new DefaultListModel();
        for(int i = 0; i<5;i++){
            sessionListModel.add(i, "Item "+(i+1));
        }
        sessionList.setModel(
            sessionListModel
        );
        sessionList.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                sessionListFocusGained(evt);
            }
        });
        jScrollPane1.setViewportView(sessionList);

        studentManagerPanel.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 55, 150, 120));

        studentList.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        studentList.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                studentListFocusGained(evt);
            }
        });
        jScrollPane2.setViewportView(studentList);

        studentManagerPanel.add(jScrollPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 55, 200, 120));

        jLabel1.setText("Session");
        studentManagerPanel.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, -1, -1));

        jLabel2.setText("Student");
        studentManagerPanel.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 40, -1, -1));

        addSessionButton.setText("Add Session");
        addSessionButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addSessionButtonActionPerformed(evt);
            }
        });
        studentManagerPanel.add(addSessionButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(420, 110, -1, -1));

        addStudentButton.setText("Add Student");
        studentManagerPanel.add(addStudentButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(420, 150, -1, -1));

        jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);
        studentManagerPanel.add(jSeparator1, new org.netbeans.lib.awtextra.AbsoluteConstraints(411, 0, 8, 180));
        studentManagerPanel.add(jSeparator2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 183, 1032, 10));

        jButton4.setText("Remove Session");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });
        studentManagerPanel.add(jButton4, new org.netbeans.lib.awtextra.AbsoluteConstraints(550, 110, -1, -1));

        jButton5.setText("Remove Student");
        studentManagerPanel.add(jButton5, new org.netbeans.lib.awtextra.AbsoluteConstraints(550, 150, -1, -1));

        jButton8.setText("Remove All");
        studentManagerPanel.add(jButton8, new org.netbeans.lib.awtextra.AbsoluteConstraints(690, 110, 97, 66));

        jSeparator3.setOrientation(javax.swing.SwingConstants.VERTICAL);
        studentManagerPanel.add(jSeparator3, new org.netbeans.lib.awtextra.AbsoluteConstraints(540, 0, 11, 180));

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        jLabel5.setForeground(new java.awt.Color(255, 0, 0));
        jLabel5.setText("Removal");
        studentManagerPanel.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(550, 10, -1, -1));

        jLabel6.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        jLabel6.setText("Selection");
        studentManagerPanel.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 10, -1, -1));

        jLabel13.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        jLabel13.setText("Adding");
        studentManagerPanel.add(jLabel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(420, 10, -1, -1));

        jTable4.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null},
                {null, null},
                {null, null},
                {null, null}
            },
            new String [] {
                "Student Name", "Average Score"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.Double.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jScrollPane5.setViewportView(jTable4);

        sortByNameButton.setText("Sort By Name");

        sortByScoreButton.setText("Sort By Score");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 1025, Short.MAX_VALUE)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(sortByNameButton)
                .addGap(18, 18, 18)
                .addComponent(sortByScoreButton)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(7, 7, 7)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(sortByNameButton)
                    .addComponent(sortByScoreButton))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(245, Short.MAX_VALUE))
        );

        studentManagerControlTabbedPane.addTab("Session Control", jPanel2);

        jPanel7.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        studentTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "ScenarioName", "isCompleted", "Suggestion", "Score"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Object.class, java.lang.Boolean.class, java.lang.Object.class, java.lang.Object.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jScrollPane4.setViewportView(studentTable);

        jPanel7.add(jScrollPane4, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 20, 1025, 222));

        jButton7.setText("View Selected Scenario Input");
        jPanel7.add(jButton7, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 340, -1, -1));

        studentNameLabel.setText("StudentName");
        jPanel7.add(studentNameLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(444, 0, -1, -1));

        printButton.setText("Print Selected Scenario Input");
        jPanel7.add(printButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 370, -1, -1));

        jLabel4.setText("AVG Simulation Score");
        jPanel7.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 293, -1, -1));

        changePasswordButton.setText("Change Student Password");
        jPanel7.add(changePasswordButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(540, 402, -1, -1));

        changeUserNameButton.setText("Change User Name");
        jPanel7.add(changeUserNameButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(540, 331, -1, -1));

        jSeparator6.setOrientation(javax.swing.SwingConstants.VERTICAL);
        jPanel7.add(jSeparator6, new org.netbeans.lib.awtextra.AbsoluteConstraints(484, 258, 50, 202));

        jLabel15.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        jLabel15.setText("Login Modification");
        jPanel7.add(jLabel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(684, 248, -1, -1));

        currentStudentUserNameLabel.setText("current Username");
        jPanel7.add(currentStudentUserNameLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(544, 311, -1, -1));

        currentStudentPasswordLabel.setText("current Password");
        jPanel7.add(currentStudentPasswordLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(544, 382, -1, -1));

        jLabel19.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        jLabel19.setText("Simulation Results");
        jPanel7.add(jLabel19, new org.netbeans.lib.awtextra.AbsoluteConstraints(121, 248, -1, -1));

        jButton1.setText("View Selected Scenario Suggestion");
        jPanel7.add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 310, -1, -1));

        studentManagerControlTabbedPane.addTab("Student Control", jPanel7);

        studentManagerPanel.add(studentManagerControlTabbedPane, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 190, 1030, 490));

        rootTabbedPane.addTab("StudentManager", studentManagerPanel);

        scenarioManagerPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        scenarioListModel = new DefaultListModel();
        scenarioListModel.add(0,"CS225 TESTING");
        scenarioListModel.add(0,"CS225 TESTING");
        scenarioListModel.add(0,"CS225 TESTING");
        scenarioListModel.add(0,"CS225 TESTING");
        scenarioList.setModel(scenarioListModel);
        scenarioList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                scenarioListValueChanged(evt);
            }
        });
        jScrollPane7.setViewportView(scenarioList);

        scenarioManagerPanel.add(jScrollPane7, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 30, 160, 76));

        jLabel7.setText("Select Scenario to edit");
        scenarioManagerPanel.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(29, 12, -1, -1));

        jSeparator4.setPreferredSize(new java.awt.Dimension(0, 10));
        scenarioManagerPanel.add(jSeparator4, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 120, 1030, 10));

        jTable3.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"Insulin", null, ""},
                {"Morphine", null, null},
                {"Cocaine", null, null},
                {null, null, null},
                {null, null, ""}
            },
            new String [] {
                "Medication", "Dose", "Hour Due"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.Object.class, java.lang.Object.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jTable3.setRowHeight(45);
        jScrollPane8.setViewportView(jTable3);

        jLabel9.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel9.setText("Room:");

        jLabel10.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel10.setText("Diagnosis:");

        jLabel14.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel14.setText("Name:");

        jLabel16.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel16.setText("Allergies:");

        jTextField1.setText("jTextField1");

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jScrollPane10.setViewportView(jTextArea1);

        jTextField2.setText("jTextField2");

        jTextArea2.setColumns(20);
        jTextArea2.setRows(5);
        jScrollPane11.setViewportView(jTextArea2);

        jButton11.setText("Add Medication");
        jButton11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton11ActionPerformed(evt);
            }
        });

        jButton19.setText("Remove Selected Medication");
        jButton19.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton19ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGap(33, 33, 33)
                        .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 932, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGap(43, 43, 43)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel10)
                            .addComponent(jLabel9))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(51, 51, 51)
                                .addComponent(jLabel14)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTextField2))
                            .addComponent(jScrollPane11, javax.swing.GroupLayout.PREFERRED_SIZE, 282, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addGap(18, 18, 18)
                                .addComponent(jLabel16)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, 324, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(126, 126, 126))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButton11)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButton19)))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGap(31, 31, 31)
                .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel9)
                        .addComponent(jLabel14)
                        .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jButton11)
                        .addComponent(jButton19)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane11, javax.swing.GroupLayout.DEFAULT_SIZE, 121, Short.MAX_VALUE)
                    .addComponent(jScrollPane10)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel16)
                            .addComponent(jLabel10))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );

        previewTabbedPane.addTab("MAR", jPanel4);

        documentationTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Date", "Time", "Narrative", "Follow Up", "Initialls"
            }
        ));
        documentationTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
        documentationTable.setName("sample");
        documentationTable.getTableHeader().setReorderingAllowed(false);
        jScrollPane9.setViewportView(documentationTable);

        jButton12.setText("Add New Narrative");

        jButton13.setText("Remove Narrative");

        jButton14.setText("RemoveAll");

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 930, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jButton12)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButton13)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton14)))
                .addContainerGap(35, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 233, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton12)
                    .addComponent(jButton13)
                    .addComponent(jButton14))
                .addContainerGap(173, Short.MAX_VALUE))
        );

        previewTabbedPane.addTab("Documentation", jPanel5);

        jLabel12.setText("Scenario Summary");

        jScrollPane3.setViewportView(scenarioSummaryTextPane);

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 252, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12))
                .addContainerGap(713, Short.MAX_VALUE))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel12)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(195, Short.MAX_VALUE))
        );

        previewTabbedPane.addTab("Summary", jPanel6);

        scenarioManagerPanel.add(previewTabbedPane, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 140, -1, -1));

        jButton10.setText("Save Changes");
        jButton10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton10ActionPerformed(evt);
            }
        });
        scenarioManagerPanel.add(jButton10, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 626, -1, -1));

        jLabel8.setText("Scenario Preview");
        scenarioManagerPanel.add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(520, 120, -1, -1));

        jButton16.setText("Undo All");
        scenarioManagerPanel.add(jButton16, new org.netbeans.lib.awtextra.AbsoluteConstraints(117, 626, -1, -1));

        jSeparator5.setOrientation(javax.swing.SwingConstants.VERTICAL);
        scenarioManagerPanel.add(jSeparator5, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 0, 10, 120));

        addScenarioButton.setText("addScenario");
        addScenarioButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addScenarioButtonActionPerformed(evt);
            }
        });
        scenarioManagerPanel.add(addScenarioButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 40, -1, -1));

        removeScenarioButton.setText("Remove Scenario");
        removeScenarioButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                removeScenarioButtonActionPerformed(evt);
            }
        });
        scenarioManagerPanel.add(removeScenarioButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(300, 40, -1, -1));

        rootTabbedPane.addTab("ScenarioManager", scenarioManagerPanel);

        javax.swing.GroupLayout logOutPanelLayout = new javax.swing.GroupLayout(logOutPanel);
        logOutPanel.setLayout(logOutPanelLayout);
        logOutPanelLayout.setHorizontalGroup(
            logOutPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 1032, Short.MAX_VALUE)
        );
        logOutPanelLayout.setVerticalGroup(
            logOutPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 682, Short.MAX_VALUE)
        );

        rootTabbedPane.addTab("Log out", logOutPanel);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(rootTabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(rootTabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 710, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        // TODO add your handling code here:
        sessionListModel.remove(sessionList.getSelectedIndex());
    }//GEN-LAST:event_jButton4ActionPerformed

    private void sessionListFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_sessionListFocusGained
        // TODO add your handling code here:
        studentList.clearSelection();
        studentManagerControlTabbedPane.setSelectedIndex(0);
    }//GEN-LAST:event_sessionListFocusGained

    private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed
        // TODO add your handling code here:
        ((DefaultTableModel)jTable3.getModel()).addRow(new Object[0]);
    }//GEN-LAST:event_jButton11ActionPerformed

    private void jButton19ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton19ActionPerformed
        // TODO add your handling code here:
        ((DefaultTableModel)jTable3.getModel()).removeRow(jTable3.getSelectedRow());
    }//GEN-LAST:event_jButton19ActionPerformed

    private void studentListFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_studentListFocusGained
        // TODO add your handling code here:
        studentManagerControlTabbedPane.setSelectedIndex(1);
    }//GEN-LAST:event_studentListFocusGained

    private void rootTabbedPaneStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_rootTabbedPaneStateChanged
        if(rootTabbedPane.getSelectedIndex()==2){
            
            if(JOptionPane.showConfirmDialog(this, "Are You Sure You want to Log out?",null,JOptionPane.YES_NO_OPTION)==JOptionPane.OK_OPTION){
                //System.exit(0);
                SimulationManager.state = SimulationManager.LOGIN_STATE;
                rootTabbedPane.setSelectedIndex(0);
                setVisible(false);
                
                
            }
            else
                rootTabbedPane.setSelectedIndex(0);
        }
    }//GEN-LAST:event_rootTabbedPaneStateChanged

    private void addSessionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addSessionButtonActionPerformed
        String sessionName = JOptionPane.showInputDialog(this, "Enter the session Name");
        sessionListModel.addElement(sessionName);
        //TODO here goes the code for adding a session to the SimulationDataStructure
       
    }//GEN-LAST:event_addSessionButtonActionPerformed

    private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton10ActionPerformed

    private void addScenarioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addScenarioButtonActionPerformed

        
        String scenarioName = JOptionPane.showInputDialog("Enter Session name");
        if(scenarioName!=null)
            scenarioListModel.addElement(scenarioName);
        scenarioList.setSelectedIndex(scenarioListModel.getSize()-1);
        if(!previewTabbedPane.isVisible())
            previewTabbedPane.setVisible(true);
        // TODO implement adding a new scenario to the DataStructure
    }//GEN-LAST:event_addScenarioButtonActionPerformed

    private void removeScenarioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeScenarioButtonActionPerformed
       String scenario = (String)scenarioListModel.get(scenarioList.getSelectedIndex());//use this string wisely!!! :)
        scenarioListModel.remove(scenarioList.getSelectedIndex());
        if(scenarioListModel.getSize()==0)
            previewTabbedPane.setVisible(false);
         // TODO remove the 
    }//GEN-LAST:event_removeScenarioButtonActionPerformed

    private void scenarioListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_scenarioListValueChanged
        // TODO add your handling code here:
        if(scenarioList.getSelectedIndex()>=0)
        updateScenarioPreview((String)scenarioListModel.get(scenarioList.getSelectedIndex()));
    }//GEN-LAST:event_scenarioListValueChanged

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MaintenanceManagerGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MaintenanceManagerGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MaintenanceManagerGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MaintenanceManagerGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        File n = new File(System.getProperty("user.dir"));
        
        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new MaintenanceManagerGUI().setVisible(true);
            }
        });
    }
    
    /**
     * Load all resources for this GUI. 
     */
    public void loadResources(){
        
    }
    /**
     * This method updates the 
     * Scenario preview(the componentes of previewTabbedPane)
     * by reloading the data stru
     * @param string name of the scenario to load to the preview from data structure.
     */
    private void updateScenarioPreview(String string) {
        //scenarioListModel.addElement("Awsome");
        
    }

    @Override
    public void setVisible(boolean b) {
        //TODO implement loading Datastructer into this GUI.
        if(b){
            loadResources();
        }
        super.setVisible(b);
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton addScenarioButton;
    private javax.swing.JButton addSessionButton;
    private javax.swing.JButton addStudentButton;
    private javax.swing.JButton changePasswordButton;
    private javax.swing.JButton changeUserNameButton;
    private javax.swing.JLabel currentStudentPasswordLabel;
    private javax.swing.JLabel currentStudentUserNameLabel;
    private javax.swing.JTable documentationTable;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton10;
    private javax.swing.JButton jButton11;
    private javax.swing.JButton jButton12;
    private javax.swing.JButton jButton13;
    private javax.swing.JButton jButton14;
    private javax.swing.JButton jButton16;
    private javax.swing.JButton jButton19;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane10;
    private javax.swing.JScrollPane jScrollPane11;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JScrollPane jScrollPane9;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JSeparator jSeparator4;
    private javax.swing.JSeparator jSeparator5;
    private javax.swing.JSeparator jSeparator6;
    private javax.swing.JTable jTable3;
    private javax.swing.JTable jTable4;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextArea jTextArea2;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JPanel logOutPanel;
    private javax.swing.JTabbedPane previewTabbedPane;
    private javax.swing.JButton printButton;
    private javax.swing.JButton removeScenarioButton;
    private javax.swing.JTabbedPane rootTabbedPane;
    private javax.swing.JList scenarioList;
    private javax.swing.JPanel scenarioManagerPanel;
    private javax.swing.JTextPane scenarioSummaryTextPane;
    private javax.swing.JList sessionList;
    private javax.swing.JButton sortByNameButton;
    private javax.swing.JButton sortByScoreButton;
    private javax.swing.JList studentList;
    private javax.swing.JTabbedPane studentManagerControlTabbedPane;
    private javax.swing.JPanel studentManagerPanel;
    private javax.swing.JLabel studentNameLabel;
    private javax.swing.JTable studentTable;
    // End of variables declaration//GEN-END:variables
}
